package com.css.fxfzysx.modules.vaomeFacilities.controller;

import com.css.fxfzysx.base.response.RestResponse;
import com.css.fxfzysx.modules.vaomeFacilities.entity.CipvMatrixEntity;
import com.css.fxfzysx.modules.vaomeFacilities.service.VmeFacilitiesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * 重大工程设施易损性分析
 */
@RestController
@RequestMapping("vmeFacilities")
public class VmeFacilitiesController {

    @Autowired
    private VmeFacilitiesService vmeFacilitiesService;

    /**
     * 修改
     * @param cipvMatrixList
     * @return
     */
    @PostMapping("updateData")
    public RestResponse updateData(@RequestBody List<CipvMatrixEntity> cipvMatrixList){
        return vmeFacilitiesService.updateData(cipvMatrixList);
    }

    /**
     * 根据编号查询(修改回显)
     * @param number
     * @return
     */
    @GetMapping("queryDataByNumber")
    public RestResponse queryDataById(String number){
        return vmeFacilitiesService.queryDataByNumber(number);
    }

    /**
     * 删除
     * @param numbers
     * @return
     */
    @GetMapping("deleteDataByNumber")
    public RestResponse deleteDataByNumber(String numbers){
        return vmeFacilitiesService.deleteDataByNumber(numbers);
    }

    /**
     * 分页查询
     * @param cipvMatrixEntity
     * @return
     */
    @GetMapping("queryCipVulnerability")
    public RestResponse queryCipVulnerability(CipvMatrixEntity cipvMatrixEntity, HttpServletRequest request){
        return vmeFacilitiesService.queryCipVulnerability(cipvMatrixEntity,request);
    }
}
